﻿<html>

<head>
<meta http-equiv=Content-Type content="text/html; charset=UTF-8">
<meta name=Generator content="Microsoft Word 14 (filtered)">
<style>
<!--
 /* Font Definitions */
 @font-face
	{font-family:宋体;
	panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
	{font-family:宋体;
	panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
	{font-family:Tahoma;
	panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
	{font-family:"\@宋体";
	panose-1:2 1 6 0 3 1 1 1 1 1;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	font-size:10.5pt;
	font-family:"Times New Roman","serif";}
h1
	{mso-style-link:"标题 1 Char";
	margin-right:0cm;
	margin-left:0cm;
	font-size:24.0pt;
	font-family:宋体;}
h3
	{mso-style-link:"标题 3 Char";
	margin-top:13.0pt;
	margin-right:0cm;
	margin-bottom:13.0pt;
	margin-left:0cm;
	text-align:justify;
	text-justify:inter-ideograph;
	line-height:173%;
	page-break-after:avoid;
	font-size:16.0pt;
	font-family:"Times New Roman","serif";}
p.MsoHeader, li.MsoHeader, div.MsoHeader
	{margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	layout-grid-mode:char;
	border:none;
	padding:0cm;
	font-size:9.0pt;
	font-family:"Times New Roman","serif";}
p.MsoFooter, li.MsoFooter, div.MsoFooter
	{margin:0cm;
	margin-bottom:.0001pt;
	layout-grid-mode:char;
	font-size:9.0pt;
	font-family:"Times New Roman","serif";}
span.1Char
	{mso-style-name:"标题 1 Char";
	mso-style-link:"标题 1";
	font-family:宋体;
	font-weight:bold;}
span.3Char
	{mso-style-name:"标题 3 Char";
	mso-style-link:"标题 3";
	font-weight:bold;}
 /* Page Definitions */
 @page WordSection1
	{size:595.3pt 841.9pt;
	margin:72.0pt 90.0pt 72.0pt 90.0pt;
	layout-grid:15.6pt;}
div.WordSection1
	{page:WordSection1;}
 /* List Definitions */
 ol
	{margin-bottom:0cm;}
ul
	{margin-bottom:0cm;}
-->
</style>

</head>

<body bgcolor=white lang=ZH-CN style='text-justify-trim:punctuation'>

<div class=WordSection1 style='layout-grid:15.6pt'>

<h1 align=center style='text-align:center'>顺序程序设计</h1>

<p class=MsoNormal align=left style='text-align:left'><span style='font-family:
宋体;color:#555555;background:white'>Ｃ程序的结构：</span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'><br>
</span><span lang=EN-US style='font-size:12.0pt;font-family:宋体'><img width=585
height=396 src="4.files/image001.jpg" style='text-decoration:initial;
orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;background-color:white;border-bottom-width:0px;
border-left-width:0px;border-right-width:0px;border-top-width:0px;color:#555555;
font-family:Tahoma, Verdana, sans-serif;font-size:14px;font-style:normal;
font-variant:normal;font-weight:normal;height:396px;letter-spacing:normal;
line-height:22px;list-style-type:none;margin-bottom:0px;margin-left:0px;
margin-right:0px;margin-top:0px;padding-bottom:0px;padding-left:0px;padding-right:
0px;padding-top:0px;text-indent:0px;text-transform:none;white-space:normal;
width:585px;word-spacing:0px'></span><span lang=EN-US style='font-family:"Tahoma","sans-serif";
color:#555555'><br>
</span><span style='font-family:宋体;color:#555555;background:white'>Ｃ程序的执行部分是由语句组成的。程序的功能也是由执行语句实现的。</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br>
<br>
</span><b><span lang=EN-US style='font-family:"Tahoma","sans-serif";color:green;
border:none windowtext 1.0pt;padding:0cm;background:white'>C</span></b><b><span
style='font-family:宋体;color:green;border:none windowtext 1.0pt;padding:0cm;
background:white'>语句可分为以下五类：</span></b><span lang=EN-US style='font-family:
"Tahoma","sans-serif";color:#555555'><br>
<br>
</span></p>

<p class=MsoNormal align=left style='margin-left:22.5pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>1.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:#555555'>表达式语句</span></p>

<p class=MsoNormal align=left style='margin-left:22.5pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>2.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:#555555'>函数调用语句</span></p>

<p class=MsoNormal align=left style='margin-left:22.5pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>3.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:#555555'>控制语句</span></p>

<p class=MsoNormal align=left style='margin-left:22.5pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>4.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:#555555'>复合语句</span></p>

<p class=MsoNormal align=left style='margin-left:22.5pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>5.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:#555555'>空语句</span></p>

<p class=MsoNormal align=left style='margin-left:22.5pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>1.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:red;border:none windowtext 1.0pt;
padding:0cm'>表达式语句</span><span style='font-family:宋体;color:#555555'>：表达式语句由表达式加上分号</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'>“</span><span
style='font-family:宋体;color:#555555'>；</span><span lang=EN-US style='font-family:
"Tahoma","sans-serif";color:#555555'>”</span><span style='font-family:宋体;
color:#555555'>组成。</span></p>

<p class=MsoNormal align=left style='text-align:left'><span style='font-family:
宋体;color:#555555;background:white'>其一般形式为：表达式；</span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'><br>
</span><span style='font-family:宋体;color:#555555;background:white'>执行表达式语句就是计算表达式的值。</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br>
<br>
</span><span style='font-family:宋体;color:#555555;background:white'>例如：</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br>
<span style='background:white'>&nbsp;&nbsp;&nbsp; x=y+z;&nbsp; </span></span><span
style='font-family:宋体;color:#555555;background:white'>赋值语句；</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br>
<span style='background:white'>&nbsp;&nbsp;&nbsp; y+z;&nbsp;&nbsp;&nbsp; </span></span><span
style='font-family:宋体;color:#555555;background:white'>加法运算语句，但计算结果不能保留，无实际意义；</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br>
<span style='background:white'>&nbsp;&nbsp;&nbsp; i++;&nbsp;&nbsp;&nbsp; </span></span><span
style='font-family:宋体;color:#555555;background:white'>自增</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>1</span><span style='font-family:宋体;color:#555555;background:white'>语句，</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>i</span><span style='font-family:宋体;color:#555555;background:white'>值增</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>1</span><span style='font-family:宋体;color:#555555;background:white'>。</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br>
<br>
</span></p>

<p class=MsoNormal align=left style='margin-left:22.5pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>2.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:red;border:none windowtext 1.0pt;
padding:0cm'>函数调用语句</span><span style='font-family:宋体;color:#555555'>：由函数名、实际参数加上分号</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'>“</span><span
style='font-family:宋体;color:#555555'>；</span><span lang=EN-US style='font-family:
"Tahoma","sans-serif";color:#555555'>”</span><span style='font-family:宋体;
color:#555555'>组成。</span></p>

<p class=MsoNormal align=left style='text-align:left'><span style='font-family:
宋体;color:#555555;background:white'>其一般形式为：函数名</span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555;background:white'>(</span><span
style='font-family:宋体;color:#555555;background:white'>实际参数表</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>)</span><span style='font-family:宋体;color:#555555;background:white'>；</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br>
</span><span style='font-family:宋体;color:#555555;background:white'>执行函数语句就是调用函数体并把实际参数赋予函数定义中的形式参数，然后执行被调函数体中的语句，求取函数值</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'> (</span><span style='font-family:宋体;color:#555555;background:white'>在后面函数中再详细介绍</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>) </span><span style='font-family:宋体;color:#555555;background:white'>。</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br>
<br>
</span><span style='font-family:宋体;color:#555555;background:white'>例如：</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br>
<span style='background:white'>printf(&quot;C Program&quot;);</span></span><span
style='font-family:宋体;color:#555555;background:white'>调用库函数，输出字符串。</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br>
<br>
</span></p>

<p class=MsoNormal align=left style='margin-left:22.5pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>3.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:red;border:none windowtext 1.0pt;
padding:0cm'>控制语句</span><span style='font-family:宋体;color:#555555'>：控制语句用于控制程序的流程，以实现程序的各种结构方式。它们由特定的语句定义符组成。Ｃ语言有九种控制语句。</span><span
style='font-family:"Tahoma","sans-serif";color:#555555'> </span><span
style='font-family:宋体;color:#555555'>可分成以下三类：</span></p>

<p class=MsoNormal align=left style='margin-left:22.5pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>1.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:#555555'>条件判断语句：</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'>if</span><span
style='font-family:宋体;color:#555555'>语句、</span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>switch</span><span
style='font-family:宋体;color:#555555'>语句；</span></p>

<p class=MsoNormal align=left style='margin-left:22.5pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>2.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:#555555'>循环执行语句：</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'>do while</span><span
style='font-family:宋体;color:#555555'>语句、</span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>while</span><span
style='font-family:宋体;color:#555555'>语句、</span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>for</span><span
style='font-family:宋体;color:#555555'>语句；</span></p>

<p class=MsoNormal align=left style='margin-left:22.5pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>3.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:#555555'>转向语句：</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'>break</span><span
style='font-family:宋体;color:#555555'>语句、</span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>goto</span><span
style='font-family:宋体;color:#555555'>语句、</span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>continue</span><span
style='font-family:宋体;color:#555555'>语句、</span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>return</span><span
style='font-family:宋体;color:#555555'>语句。</span></p>

<p class=MsoNormal align=left style='margin-left:22.5pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>4.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:#555555'>复合语句：把多个语句用括号</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'>{}</span><span
style='font-family:宋体;color:#555555'>括起来组成的一个语句称复合语句。</span></p>

<p class=MsoNormal align=left style='text-align:left'><span style='font-family:
宋体;color:#555555;background:white'>在程序中应把复合语句看成是单条语句，而不是多条语句。</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br>
</span><span style='font-family:宋体;color:#555555;background:white'>例如：</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br>
<span style='background:white'>&nbsp;&nbsp;&nbsp; { x=y+z;</span><br>
<span style='background:white'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a=b+c;</span><br>
<span style='background:white'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf(“%d%d”</span></span><span
style='font-family:宋体;color:#555555;background:white'>，</span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555;background:white'>x</span><span
style='font-family:宋体;color:#555555;background:white'>，</span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555;background:white'>a)</span><span
style='font-family:宋体;color:#555555;background:white'>；</span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'><br>
<span style='background:white'>&nbsp;&nbsp;&nbsp;&nbsp; }</span><br>
</span><span style='font-family:宋体;color:#555555;background:white'>是一条复合语句。复合语句内的各条语句都必须以分号</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>“;”</span><span style='font-family:宋体;color:#555555;background:white'>结尾，在括号</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>“}”</span><span style='font-family:宋体;color:#555555;background:white'>外不能加分号。</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br>
<br>
</span></p>

<p class=MsoNormal align=left style='margin-left:22.5pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>5.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:red;border:none windowtext 1.0pt;
padding:0cm'>空语句</span><span style='font-family:宋体;color:#555555'>：只有分号</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'>“</span><span
style='font-family:宋体;color:#555555'>；</span><span lang=EN-US style='font-family:
"Tahoma","sans-serif";color:#555555'>”</span><span style='font-family:宋体;
color:#555555'>组成的语句称为空语句。空语句是什么也不执行的语句。在程序中空语句可用来作空循环体。</span></p>

<p class=MsoNormal><span style='font-family:宋体;color:#555555;background:white'>例如</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br>
<span style='background:white'>&nbsp;&nbsp;&nbsp; while(getchar()!='\n');</span><br>
<br>
</span><span style='font-family:宋体;color:#555555;background:white'>本语句的功能是，只要从键盘输入的字符不是回车则重新输入。这里的循环体为空语句。</span></p>

<p class=MsoNormal align=left style='margin-left:22.5pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>1.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:#555555;border:none windowtext 1.0pt;
padding:0cm'>所谓输入输出是以计算机为主体而言的。</span></p>

<p class=MsoNormal align=left style='margin-left:22.5pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>2.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:#555555;border:none windowtext 1.0pt;
padding:0cm'>本章介绍的是向标准输出设备显示器输出数据的语句。</span></p>

<p class=MsoNormal align=left style='margin-left:22.5pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>3.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:#555555;border:none windowtext 1.0pt;
padding:0cm'>在Ｃ语言中，所有的数据输入／输出都是由库函数完成的。因此都是函数语句。</span></p>

<p class=MsoNormal align=left style='margin-left:22.5pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>4.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:#555555;border:none windowtext 1.0pt;
padding:0cm'>在使用Ｃ语言库函数时，要用预编译命令</span></p>

<p class=MsoNormal align=left style='text-align:left'><span lang=EN-US
style='font-family:"Courier New";color:#555555;border:none windowtext 1.0pt;
padding:0cm;background:white'>#include<br>
</span><span style='font-family:宋体;color:#555555;border:none windowtext 1.0pt;
padding:0cm;background:white'>将有关</span><span lang=EN-US style='font-family:
"Courier New";color:#555555;border:none windowtext 1.0pt;padding:0cm;
background:white'>“</span><span style='font-family:宋体;color:#555555;border:
none windowtext 1.0pt;padding:0cm;background:white'>头文件</span><span lang=EN-US
style='font-family:"Courier New";color:#555555;border:none windowtext 1.0pt;
padding:0cm;background:white'>”</span><span style='font-family:宋体;color:#555555;
border:none windowtext 1.0pt;padding:0cm;background:white'>包括到源文件中。使用标准输入输出库函数时要用到</span><span
lang=EN-US style='font-family:"Courier New";color:#555555;border:none windowtext 1.0pt;
padding:0cm;background:white'> “stdio.h”</span><span style='font-family:宋体;
color:#555555;border:none windowtext 1.0pt;padding:0cm;background:white'>文件，因此源文件开头应有以下预编译命令：</span><span
lang=EN-US style='font-family:"Courier New";color:#555555;border:none windowtext 1.0pt;
padding:0cm;background:white'><br>
#include&lt; stdio.h &gt;<br>
<br>
</span><span style='font-family:宋体;color:#555555;border:none windowtext 1.0pt;
padding:0cm;background:white'>或</span><span lang=EN-US style='font-family:"Courier New";
color:#555555;border:none windowtext 1.0pt;padding:0cm;background:white'><br>
#include ”stdio.h”<br>
stdio</span><span style='font-family:宋体;color:#555555;border:none windowtext 1.0pt;
padding:0cm;background:white'>是</span><span lang=EN-US style='font-family:"Courier New";
color:#555555;border:none windowtext 1.0pt;padding:0cm;background:white'>standard
input &amp;outupt</span><span style='font-family:宋体;color:#555555;border:none windowtext 1.0pt;
padding:0cm;background:white'>的意思。</span><span lang=EN-US style='font-family:
"Tahoma","sans-serif";color:#555555'><br>
<br>
</span></p>

<p class=MsoNormal align=left style='margin-left:22.5pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>5.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:#555555;border:none windowtext 1.0pt;
padding:0cm'>考虑到</span><span lang=EN-US style='font-family:"Courier New";
color:#555555;border:none windowtext 1.0pt;padding:0cm'>printf</span><span
style='font-family:宋体;color:#555555;border:none windowtext 1.0pt;padding:0cm'>和</span><span
lang=EN-US style='font-family:"Courier New";color:#555555;border:none windowtext 1.0pt;
padding:0cm'>scanf</span><span style='font-family:宋体;color:#555555;border:none windowtext 1.0pt;
padding:0cm'>函数使用频繁，系统允许在使用这两个函数时可不加</span></p>

<p class=MsoNormal><span lang=EN-US style='font-family:"Courier New";
color:#555555;border:none windowtext 1.0pt;padding:0cm;background:white'>#include&lt;
stdio.h &gt;<br>
</span><span style='font-family:宋体;color:#555555;border:none windowtext 1.0pt;
padding:0cm;background:white'>或</span><span lang=EN-US style='font-family:"Courier New";
color:#555555;border:none windowtext 1.0pt;padding:0cm;background:white'><br>
#include ”stdio.h”</span></p>

<p class=MsoNormal><span lang=EN-US style='font-family:"Courier New";
color:#555555;border:none windowtext 1.0pt;padding:0cm;background:white'>&nbsp;</span></p>

<h3 style='margin:0cm;margin-bottom:.0001pt;line-height:30.0pt;background:white;
vertical-align:middle'><span lang=EN-US style='font-family:"Tahoma","sans-serif";
color:#555555'>4.1.1putchar </span><span style='font-family:宋体;color:#555555'>函数（字符输出函数）</span></h3>

<p class=MsoNormal><span lang=EN-US style='font-family:"Tahoma","sans-serif";
color:#555555;background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>putchar </span><span style='font-family:宋体;
color:#555555;background:white'>函数是字符输出函数，其功能是在显示器上输出单个字符。</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>其一般形式为：</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>putchar(</span></span><span style='font-family:
宋体;color:#555555;background:white'>字符变量</span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555;background:white'>)</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>例如：</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp;&nbsp;&nbsp; putchar('A');&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:#555555;background:white'>（输出大写字母</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>A</span><span style='font-family:宋体;color:#555555;background:white'>）</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp;&nbsp;&nbsp;
putchar(x);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style='font-family:
宋体;color:#555555;background:white'>（输出字符变量</span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555;background:white'>x</span><span
style='font-family:宋体;color:#555555;background:white'>的值）</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>putchar(‘\101’); </span></span><span
style='font-family:宋体;color:#555555;background:white'>（也是输出字符</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>A</span><span style='font-family:宋体;color:#555555;background:white'>）</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>putchar('\n');&nbsp;&nbsp; </span></span><span
style='font-family:宋体;color:#555555;background:white'>（换行）</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>对控制字符则执行控制功能，不在屏幕上显示。</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>使用本函数前必须要用文件包含命令：</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>#include&lt;stdio.h&gt;</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>或</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>#include “stdio.h”</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>【例</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>4.1</span><span style='font-family:宋体;color:#555555;background:white'>】输出单个字符。</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>#include&lt;stdio.h&gt;</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>main(){</span></span><br style='text-decoration:
initial;orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; char a='B',b='o',c='k';</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp;
putchar(a);putchar(b);putchar(b);putchar(c);putchar('\t');</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; putchar(a);putchar(b);</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; putchar('\n');</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; putchar(b);putchar(c);</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp;}</span></span><br style='text-decoration:
initial;orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<br style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<br>
</span></p>

<h3 style='margin:0cm;margin-bottom:.0001pt;line-height:30.0pt;background:white;
vertical-align:middle'><span lang=EN-US style='font-family:"Tahoma","sans-serif";
color:#555555'>4.1.2getchar</span><span style='font-family:宋体;color:#555555'>函数（键盘输入函数）</span></h3>

<p class=MsoNormal><span lang=EN-US style='font-family:"Tahoma","sans-serif";
color:#555555;background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>getchar</span><span style='font-family:宋体;
color:#555555;background:white'>函数的功能是从键盘上输入一个字符。</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>其一般形式为：</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp;&nbsp;&nbsp; getchar();</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>通常把输入的字符赋予一个字符变量，构成赋值语句，如：</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp;&nbsp;&nbsp; char c;</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
c=getchar();</span></span><br style='text-decoration:initial;orphans: 2;
text-align:start;widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
word-spacing:0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>【例</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>4.2</span><span style='font-family:宋体;color:#555555;background:white'>】输入单个字符。</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>#include&lt;stdio.h&gt;</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>void main(){</span></span><br style='text-decoration:
initial;orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; char c;</span></span><br style='text-decoration:
initial;orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; printf(&quot;input a character\n&quot;);</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; c=getchar();</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; putchar(c);</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>}</span></span><br style='text-decoration:initial;
orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<br style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>使用</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>getchar</span><span style='font-family:宋体;color:#555555;background:white'>函数还应注意几个问题：</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<br>
</span></p>

<p class=MsoNormal align=left style='margin-left:22.5pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>1.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span lang=EN-US style='font-family:"Tahoma","sans-serif";
color:#555555'>getchar</span><span style='font-family:宋体;color:#555555'>函数只能接受单个字符，输入数字也按字符处理。输入多于一个字符时，只接收第一个字符。</span></p>

<p class=MsoNormal align=left style='margin-left:22.5pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>2.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:#555555'>使用本函数前必须包含文件</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'>“stdio.h”</span><span
style='font-family:宋体;color:#555555'>。</span></p>

<p class=MsoNormal align=left style='margin-left:22.5pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>3.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:#555555'>在</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'>TC</span><span
style='font-family:宋体;color:#555555'>屏幕下运行含本函数程序时，将退出</span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>TC </span><span
style='font-family:宋体;color:#555555'>屏幕进入用户屏幕等待用户输入。输入完毕再返回</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'>TC</span><span
style='font-family:宋体;color:#555555'>屏幕。</span></p>

<p class=MsoNormal align=left style='margin-left:22.5pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>4.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:#555555'>程序最后两行可用下面两行的任意一行代替：</span></p>

<p class=MsoNormal><span lang=EN-US style='font-family:"Tahoma","sans-serif";
color:#555555;background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>putchar(getchar());</span></span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'><br style='text-decoration:
initial;orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>printf(“%c”,getchar());</span></span></span></p>

<h3 style='margin:0cm;margin-bottom:.0001pt;line-height:30.0pt;background:white;
vertical-align:middle'><span lang=EN-US style='font-size:12.0pt;font-family:
"Tahoma","sans-serif";color:red;border:none windowtext 1.0pt;padding:0cm'>4.1.1printf</span><span
style='font-size:12.0pt;font-family:宋体;color:red;border:none windowtext 1.0pt;
padding:0cm'>函数（格式输出函数）</span></span></h3>

<p class=MsoNormal><span lang=EN-US style='font-family:"Tahoma","sans-serif";
color:#555555;background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>printf</span><span style='font-family:宋体;
color:#555555;background:white'>函数称为格式输出函数，其关键字最末一个字母</span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555;background:white'>f</span><span
style='font-family:宋体;color:#555555;background:white'>即为</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>“</span><span style='font-family:宋体;color:#555555;background:white'>格式</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>”(format)</span><span style='font-family:宋体;color:#555555;background:
white'>之意。其功能是按用户指定的格式，把指定的数据显示到显示器屏幕上。在前面的例题中我们已多次使用过这个函数。</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<br>
</span></p>

<p class=MsoNormal align=left style='margin-left:22.5pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>1.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span lang=EN-US style='font-family:"Tahoma","sans-serif";
color:green;border:none windowtext 1.0pt;padding:0cm'><span style='text-decoration:
initial'>printf</span><span style='font-family:宋体;color:green;border:none windowtext 1.0pt;
padding:0cm'>函数调用的一般形式</span></span></p>

<p class=MsoNormal><span lang=EN-US style='font-family:"Tahoma","sans-serif";
color:#555555;background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>printf</span><span style='font-family:宋体;
color:#555555;background:white'>函数是一个标准库函数，它的函数原型在头文件</span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555;background:white'>“stdio.h”</span><span
style='font-family:宋体;color:#555555;background:white'>中。但作为一个特例，不要求在使用</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'> printf </span><span style='font-family:宋体;color:#555555;background:
white'>函数之前必须包含</span><span lang=EN-US style='font-family:"Tahoma","sans-serif";
color:#555555;background:white'>stdio.h</span><span style='font-family:宋体;
color:#555555;background:white'>文件。</span><span lang=EN-US style='font-family:
"Tahoma","sans-serif";color:#555555;background:white'>printf</span><span
style='font-family:宋体;color:#555555;background:white'>函数调用的一般形式为：</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp;&nbsp;&nbsp; printf(“</span></span><span
style='font-family:宋体;color:#555555;background:white'>格式控制字符串</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>”</span><span style='font-family:宋体;color:#555555;background:white'>，输出表列</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>)</span></span><span lang=EN-US style='font-family:"Tahoma","sans-serif";
color:#555555'><br style='text-decoration:initial;orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
word-spacing:0px'>
<br style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>其中格式控制字符串用于指定输出格式。格式控制串可由格式字符串和非格式字符串两种组成。格式字符串是以</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>%</span><span style='font-family:宋体;color:#555555;background:white'>开头的字符串，在</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>%</span><span style='font-family:宋体;color:#555555;background:white'>后面跟有各种格式字符，以说明输出数据的类型、形式、长度、小数位数等。如：</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>“%d”</span></span><span style='font-family:宋体;
color:#555555;background:white'>表示按十进制整型输出；</span></span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'><br style='text-decoration:
initial;orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>“%ld”</span></span><span style='font-family:宋体;
color:#555555;background:white'>表示按十进制长整型输出；</span></span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'><br style='text-decoration:
initial;orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>“%c”</span></span><span style='font-family:宋体;
color:#555555;background:white'>表示按字符型输出等。</span></span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'><br style='text-decoration:
initial;orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<br style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>非格式字符串在输出时原样照印，在显示中起提示作用。输出表列中给出了各个输出项，要求格式字符串和各输出项在数量和类型上应该一一对应。</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<br style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>【例</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>4.3</span><span style='font-family:宋体;color:#555555;background:white'>】</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>main()</span></span><br style='text-decoration:
initial;orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>{</span></span><br style='text-decoration:initial;
orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; int a=88,b=89;</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; printf(&quot;%d %d\n&quot;,a,b);</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; printf(&quot;%d,%d\n&quot;,a,b);</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; printf(&quot;%c,%c\n&quot;,a,b);</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; printf(&quot;a=%d,b=%d&quot;,a,b);</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>}</span></span><br style='text-decoration:initial;
orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<br style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>本例中四次输出了</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>a,b</span><span style='font-family:宋体;color:#555555;background:white'>的值，但由于格式控制串不同，输出的结果也不相同。第四行的输出语句格式控制串中，两格式串</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>%d </span><span style='font-family:宋体;color:#555555;background:white'>之间加了一个空格</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>(</span><span style='font-family:宋体;color:#555555;background:white'>非格式字符</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>)</span><span style='font-family:宋体;color:#555555;background:white'>，所以输出的</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>a,b</span><span style='font-family:宋体;color:#555555;background:white'>值之间有一个空格。第五行的</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>printf</span><span style='font-family:宋体;color:#555555;background:white'>语句格式控制串中加入的是非格式字符逗号，因此输出</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>的</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>a,b</span><span style='font-family:宋体;color:#555555;background:white'>值之间加了一个逗号。第六行的格式串要求按字符型输出</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'> a,b</span><span style='font-family:宋体;color:#555555;background:white'>值。第七行中为了提示输出结果又增加了非格式字符串。</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<br>
</span></p>

<p class=MsoNormal align=left style='margin-left:22.5pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>2.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:green;border:none windowtext 1.0pt;
padding:0cm'><span style='text-decoration:initial'>格式字符串</span></span></p>

<p class=MsoNormal><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>在</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>Turbo C</span><span style='font-family:宋体;color:#555555;background:white'>中格式字符串的一般形式为：</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>&nbsp;[</span><span style='font-family:宋体;color:#555555;background:white'>标志</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>][</span><span style='font-family:宋体;color:#555555;background:white'>输出最小宽度</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>][.</span><span style='font-family:宋体;color:#555555;background:white'>精度</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>][</span><span style='font-family:宋体;color:#555555;background:white'>长度</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>]</span><span style='font-family:宋体;color:#555555;background:white'>类型。其中方括号</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>[]</span><span style='font-family:宋体;color:#555555;background:white'>中的项为可选项。</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<br style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>各项的意义介绍如下：</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<br>
</span></p>

<p class=MsoNormal align=left style='margin-left:22.5pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>1.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:#555555'>类型：类型字符用以表示输出数据的类型，其格式符和意义如下表所示：</span></p>

<div align=center>

<table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0
 style='background:white;border-collapse:collapse;text-decoration:initial;
 orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
 -webkit-text-stroke-width: 0px;word-spacing:0px'>
 <tr style='text-decoration:initial'>
  <td width=103 style='width:77.25pt;border:solid #999999 1.0pt;padding:3.75pt 3.75pt 3.75pt 3.75pt;
  text-decoration:initial'>
  <p class=MsoNormal style='line-height:16.5pt'><span style='font-family:宋体;
  color:#555555'>格式字符</span></p>
  </td>
  <td width=396 style='width:297.0pt;border:solid #999999 1.0pt;border-left:
  none;padding:3.75pt 3.75pt 3.75pt 3.75pt;text-decoration:initial'>
  <p class=MsoNormal style='line-height:16.5pt'><span style='font-family:宋体;
  color:#555555'>意</span><span lang=EN-US style='font-family:"Tahoma","sans-serif";
  color:#555555'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  </span><span style='font-family:宋体;color:#555555'>义</span></p>
  </td>
 </tr>
 <tr style='text-decoration:initial'>
  <td width=103 style='width:77.25pt;border:solid #999999 1.0pt;border-top:
  none;padding:3.75pt 3.75pt 3.75pt 3.75pt;text-decoration:initial'>
  <p class=MsoNormal style='line-height:16.5pt'><span lang=EN-US
  style='font-family:"Tahoma","sans-serif";color:#555555'>d</span></p>
  </td>
  <td width=396 style='width:297.0pt;border-top:none;border-left:none;
  border-bottom:solid #999999 1.0pt;border-right:solid #999999 1.0pt;
  padding:3.75pt 3.75pt 3.75pt 3.75pt;text-decoration:initial'>
  <p class=MsoNormal style='line-height:16.5pt'><span style='font-family:宋体;
  color:#555555'>以十进制形式输出带符号整数</span><span lang=EN-US style='font-family:"Tahoma","sans-serif";
  color:#555555'>(</span><span style='font-family:宋体;color:#555555'>正数不输出符号</span><span
  lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'>)</span></p>
  </td>
 </tr>
 <tr style='text-decoration:initial'>
  <td width=103 style='width:77.25pt;border:solid #999999 1.0pt;border-top:
  none;padding:3.75pt 3.75pt 3.75pt 3.75pt;text-decoration:initial'>
  <p class=MsoNormal style='line-height:16.5pt'><span lang=EN-US
  style='font-family:"Tahoma","sans-serif";color:#555555'>o</span></p>
  </td>
  <td width=396 style='width:297.0pt;border-top:none;border-left:none;
  border-bottom:solid #999999 1.0pt;border-right:solid #999999 1.0pt;
  padding:3.75pt 3.75pt 3.75pt 3.75pt;text-decoration:initial'>
  <p class=MsoNormal style='line-height:16.5pt'><span style='font-family:宋体;
  color:#555555'>以八进制形式输出无符号整数</span><span lang=EN-US style='font-family:"Tahoma","sans-serif";
  color:#555555'>(</span><span style='font-family:宋体;color:#555555'>不输出前缀</span><span
  lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'>0)</span></p>
  </td>
 </tr>
 <tr style='text-decoration:initial'>
  <td width=103 style='width:77.25pt;border:solid #999999 1.0pt;border-top:
  none;padding:3.75pt 3.75pt 3.75pt 3.75pt;text-decoration:initial'>
  <p class=MsoNormal style='line-height:16.5pt'><span lang=EN-US
  style='font-family:"Tahoma","sans-serif";color:#555555'>x,X</span></p>
  </td>
  <td width=396 style='width:297.0pt;border-top:none;border-left:none;
  border-bottom:solid #999999 1.0pt;border-right:solid #999999 1.0pt;
  padding:3.75pt 3.75pt 3.75pt 3.75pt;text-decoration:initial'>
  <p class=MsoNormal style='line-height:16.5pt'><span style='font-family:宋体;
  color:#555555'>以十六进制形式输出无符号整数</span><span lang=EN-US style='font-family:"Tahoma","sans-serif";
  color:#555555'>(</span><span style='font-family:宋体;color:#555555'>不输出前缀</span><span
  lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'>Ox)</span></p>
  </td>
 </tr>
 <tr style='text-decoration:initial'>
  <td width=103 style='width:77.25pt;border:solid #999999 1.0pt;border-top:
  none;padding:3.75pt 3.75pt 3.75pt 3.75pt;text-decoration:initial'>
  <p class=MsoNormal style='line-height:16.5pt'><span lang=EN-US
  style='font-family:"Tahoma","sans-serif";color:#555555'>u</span></p>
  </td>
  <td width=396 style='width:297.0pt;border-top:none;border-left:none;
  border-bottom:solid #999999 1.0pt;border-right:solid #999999 1.0pt;
  padding:3.75pt 3.75pt 3.75pt 3.75pt;text-decoration:initial'>
  <p class=MsoNormal style='line-height:16.5pt'><span style='font-family:宋体;
  color:#555555'>以十进制形式输出无符号整数</span></p>
  </td>
 </tr>
 <tr style='text-decoration:initial'>
  <td width=103 style='width:77.25pt;border:solid #999999 1.0pt;border-top:
  none;padding:3.75pt 3.75pt 3.75pt 3.75pt;text-decoration:initial'>
  <p class=MsoNormal style='line-height:16.5pt'><span lang=EN-US
  style='font-family:"Tahoma","sans-serif";color:#555555'>f</span></p>
  </td>
  <td width=396 style='width:297.0pt;border-top:none;border-left:none;
  border-bottom:solid #999999 1.0pt;border-right:solid #999999 1.0pt;
  padding:3.75pt 3.75pt 3.75pt 3.75pt;text-decoration:initial'>
  <p class=MsoNormal style='line-height:16.5pt'><span style='font-family:宋体;
  color:#555555'>以小数形式输出单、双精度实数</span></p>
  </td>
 </tr>
 <tr style='text-decoration:initial'>
  <td width=103 style='width:77.25pt;border:solid #999999 1.0pt;border-top:
  none;padding:3.75pt 3.75pt 3.75pt 3.75pt;text-decoration:initial'>
  <p class=MsoNormal style='line-height:16.5pt'><span lang=EN-US
  style='font-family:"Tahoma","sans-serif";color:#555555'>e,E</span></p>
  </td>
  <td width=396 style='width:297.0pt;border-top:none;border-left:none;
  border-bottom:solid #999999 1.0pt;border-right:solid #999999 1.0pt;
  padding:3.75pt 3.75pt 3.75pt 3.75pt;text-decoration:initial'>
  <p class=MsoNormal style='line-height:16.5pt'><span style='font-family:宋体;
  color:#555555'>以指数形式输出单、双精度实数</span></p>
  </td>
 </tr>
 <tr style='text-decoration:initial'>
  <td width=103 style='width:77.25pt;border:solid #999999 1.0pt;border-top:
  none;padding:3.75pt 3.75pt 3.75pt 3.75pt;text-decoration:initial'>
  <p class=MsoNormal style='line-height:16.5pt'><span lang=EN-US
  style='font-family:"Tahoma","sans-serif";color:#555555'>g,G</span></p>
  </td>
  <td width=396 style='width:297.0pt;border-top:none;border-left:none;
  border-bottom:solid #999999 1.0pt;border-right:solid #999999 1.0pt;
  padding:3.75pt 3.75pt 3.75pt 3.75pt;text-decoration:initial'>
  <p class=MsoNormal style='line-height:16.5pt'><span style='font-family:宋体;
  color:#555555'>以</span><span lang=EN-US style='font-family:"Tahoma","sans-serif";
  color:#555555'>%f</span><span style='font-family:宋体;color:#555555'>或</span><span
  lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'>%e</span><span
  style='font-family:宋体;color:#555555'>中较短的输出宽度输出单、双精度实数</span></p>
  </td>
 </tr>
 <tr style='text-decoration:initial'>
  <td width=103 style='width:77.25pt;border:solid #999999 1.0pt;border-top:
  none;padding:3.75pt 3.75pt 3.75pt 3.75pt;text-decoration:initial'>
  <p class=MsoNormal style='line-height:16.5pt'><span lang=EN-US
  style='font-family:"Tahoma","sans-serif";color:#555555'>c</span></p>
  </td>
  <td width=396 style='width:297.0pt;border-top:none;border-left:none;
  border-bottom:solid #999999 1.0pt;border-right:solid #999999 1.0pt;
  padding:3.75pt 3.75pt 3.75pt 3.75pt;text-decoration:initial'>
  <p class=MsoNormal style='line-height:16.5pt'><span style='font-family:宋体;
  color:#555555'>输出单个字符</span></p>
  </td>
 </tr>
 <tr style='text-decoration:initial'>
  <td width=103 style='width:77.25pt;border:solid #999999 1.0pt;border-top:
  none;padding:3.75pt 3.75pt 3.75pt 3.75pt;text-decoration:initial'>
  <p class=MsoNormal style='line-height:16.5pt'><span lang=EN-US
  style='font-family:"Tahoma","sans-serif";color:#555555'>s</span></p>
  </td>
  <td width=396 style='width:297.0pt;border-top:none;border-left:none;
  border-bottom:solid #999999 1.0pt;border-right:solid #999999 1.0pt;
  padding:3.75pt 3.75pt 3.75pt 3.75pt;text-decoration:initial'>
  <p class=MsoNormal style='line-height:16.5pt'><span style='font-family:宋体;
  color:#555555'>输出字符串</span></p>
  </td>
 </tr>
</table>

</div>

<p class=MsoNormal style='line-height:16.5pt;background:white'><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'>&nbsp;</span></p>

<p class=MsoNormal align=left style='margin-left:22.5pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>2.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:#555555'>标志：标志字符为</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'>-</span><span
style='font-family:宋体;color:#555555'>、</span><span lang=EN-US style='font-family:
"Tahoma","sans-serif";color:#555555'>+</span><span style='font-family:宋体;
color:#555555'>、</span><span lang=EN-US style='font-family:"Tahoma","sans-serif";
color:#555555'>#</span><span style='font-family:宋体;color:#555555'>、空格四种，其意义下表所示：</span></p>

<div align=center>

<table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0
 style='background:white;border-collapse:collapse;text-decoration:initial;
 orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
 -webkit-text-stroke-width: 0px;word-spacing:0px'>
 <tr style='text-decoration:initial'>
  <td width=67 style='width:50.25pt;border:solid #999999 1.0pt;padding:3.75pt 3.75pt 3.75pt 3.75pt;
  text-decoration:initial'>
  <p class=MsoNormal style='line-height:16.5pt'><span style='font-family:宋体;
  color:#555555'>标</span><span style='font-family:"Tahoma","sans-serif";
  color:#555555'> </span><span style='font-family:宋体;color:#555555'>志</span></p>
  </td>
  <td width=430 style='width:322.5pt;border:solid #999999 1.0pt;border-left:
  none;padding:3.75pt 3.75pt 3.75pt 3.75pt;text-decoration:initial'>
  <p class=MsoNormal style='line-height:16.5pt'><span style='font-family:宋体;
  color:#555555'>意</span><span lang=EN-US style='font-family:"Tahoma","sans-serif";
  color:#555555'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span
  style='font-family:宋体;color:#555555'>义</span></p>
  </td>
 </tr>
 <tr style='text-decoration:initial'>
  <td width=67 style='width:50.25pt;border:solid #999999 1.0pt;border-top:none;
  padding:3.75pt 3.75pt 3.75pt 3.75pt;text-decoration:initial'>
  <p class=MsoNormal style='line-height:16.5pt'><span lang=EN-US
  style='font-family:"Tahoma","sans-serif";color:#555555'>-</span></p>
  </td>
  <td width=430 style='width:322.5pt;border-top:none;border-left:none;
  border-bottom:solid #999999 1.0pt;border-right:solid #999999 1.0pt;
  padding:3.75pt 3.75pt 3.75pt 3.75pt;text-decoration:initial'>
  <p class=MsoNormal style='line-height:16.5pt'><span style='font-family:宋体;
  color:#555555'>结果左对齐，右边填空格</span></p>
  </td>
 </tr>
 <tr style='text-decoration:initial'>
  <td width=67 style='width:50.25pt;border:solid #999999 1.0pt;border-top:none;
  padding:3.75pt 3.75pt 3.75pt 3.75pt;text-decoration:initial'>
  <p class=MsoNormal style='line-height:16.5pt'><span lang=EN-US
  style='font-family:"Tahoma","sans-serif";color:#555555'>+</span></p>
  </td>
  <td width=430 style='width:322.5pt;border-top:none;border-left:none;
  border-bottom:solid #999999 1.0pt;border-right:solid #999999 1.0pt;
  padding:3.75pt 3.75pt 3.75pt 3.75pt;text-decoration:initial'>
  <p class=MsoNormal style='line-height:16.5pt'><span style='font-family:宋体;
  color:#555555'>输出符号</span><span lang=EN-US style='font-family:"Tahoma","sans-serif";
  color:#555555'>(</span><span style='font-family:宋体;color:#555555'>正号或负号</span><span
  lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'>)</span></p>
  </td>
 </tr>
 <tr style='text-decoration:initial'>
  <td width=67 style='width:50.25pt;border:solid #999999 1.0pt;border-top:none;
  padding:3.75pt 3.75pt 3.75pt 3.75pt;text-decoration:initial'>
  <p class=MsoNormal style='line-height:16.5pt'><span style='font-family:宋体;
  color:#555555'>空格</span></p>
  </td>
  <td width=430 style='width:322.5pt;border-top:none;border-left:none;
  border-bottom:solid #999999 1.0pt;border-right:solid #999999 1.0pt;
  padding:3.75pt 3.75pt 3.75pt 3.75pt;text-decoration:initial'>
  <p class=MsoNormal style='line-height:16.5pt'><span style='font-family:宋体;
  color:#555555'>输出值为正时冠以空格，为负时冠以负号</span></p>
  </td>
 </tr>
 <tr style='text-decoration:initial'>
  <td width=67 style='width:50.25pt;border:solid #999999 1.0pt;border-top:none;
  padding:3.75pt 3.75pt 3.75pt 3.75pt;text-decoration:initial'>
  <p class=MsoNormal style='line-height:16.5pt'><span lang=EN-US
  style='font-family:"Tahoma","sans-serif";color:#555555'>#</span></p>
  </td>
  <td width=430 style='width:322.5pt;border-top:none;border-left:none;
  border-bottom:solid #999999 1.0pt;border-right:solid #999999 1.0pt;
  padding:3.75pt 3.75pt 3.75pt 3.75pt;text-decoration:initial'>
  <p class=MsoNormal style='line-height:16.5pt'><span style='font-family:宋体;
  color:#555555'>对</span><span lang=EN-US style='font-family:"Tahoma","sans-serif";
  color:#555555'>c,s,d,u</span><span style='font-family:宋体;color:#555555'>类无影响；对</span><span
  lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'>o</span><span
  style='font-family:宋体;color:#555555'>类</span><span lang=EN-US
  style='font-family:"Tahoma","sans-serif";color:#555555'>,</span><span
  style='font-family:宋体;color:#555555'>在输出时加前缀</span><span lang=EN-US
  style='font-family:"Tahoma","sans-serif";color:#555555'>o</span><span
  style='font-family:宋体;color:#555555'>；对</span><span lang=EN-US
  style='font-family:"Tahoma","sans-serif";color:#555555'>x</span><span
  style='font-family:宋体;color:#555555'>类</span><span lang=EN-US
  style='font-family:"Tahoma","sans-serif";color:#555555'>,</span><span
  style='font-family:宋体;color:#555555'>在输出时加前缀</span><span lang=EN-US
  style='font-family:"Tahoma","sans-serif";color:#555555'>0x</span><span
  style='font-family:宋体;color:#555555'>；对</span><span lang=EN-US
  style='font-family:"Tahoma","sans-serif";color:#555555'>e,g,f </span><span
  style='font-family:宋体;color:#555555'>类当结果有小数时才给出小数点</span></p>
  </td>
 </tr>
</table>

</div>

<p class=MsoNormal style='line-height:16.5pt;background:white'><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'>&nbsp;</span></p>

<p class=MsoNormal align=left style='margin-left:22.5pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>3.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:#555555'>输出最小宽度</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'>:</span><span
style='font-family:宋体;color:#555555'>用十进制整数来表示输出的最少位数。若实际位数多于定义的宽度，则按实际位数输出，若实际位数少于定义的宽度则补以空格或</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'>0</span><span
style='font-family:宋体;color:#555555'>。</span></p>

<p class=MsoNormal align=left style='margin-left:22.5pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>4.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:#555555'>精度</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'>:</span><span
style='font-family:宋体;color:#555555'>精度格式符以</span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>“.”</span><span
style='font-family:宋体;color:#555555'>开头，后跟十进制整数。本项的意义是：如果输出数字，则表示小数的位数；如果输出的是字符，则表示输出字符的个数；若实际位数大于所定义的精度数，则截去超过的部分。</span></p>

<p class=MsoNormal align=left style='margin-left:22.5pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>4.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:#555555'>长度</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'>:</span><span
style='font-family:宋体;color:#555555'>长度格式符为</span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>h,l</span><span
style='font-family:宋体;color:#555555'>两种，</span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>h</span><span
style='font-family:宋体;color:#555555'>表示按短整型量输出，</span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>l</span><span
style='font-family:宋体;color:#555555'>表示按长整型量输出。</span></p>

<p class=MsoNormal><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>【例</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>4.4</span><span style='font-family:宋体;color:#555555;background:white'>】</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>main()</span></span><br style='text-decoration:
initial;orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>{</span></span><br style='text-decoration:initial;
orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; int a=15;</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; float b=123.1234567;</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; double c=12345678.1234567;</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; char d='p';</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp;
printf(&quot;a=%d,%5d,%o,%x\n&quot;,a,a,a,a);</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp;
printf(&quot;b=%f,%lf,%5.4lf,%e\n&quot;,b,b,b,b);</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; printf(&quot;c=%lf,%f,%8.4lf\n&quot;,c,c,c);</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; printf(&quot;d=%c,%8c\n&quot;,d,d);</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp;}</span></span><br style='text-decoration:
initial;orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<br style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp;&nbsp;&nbsp; </span></span><span
style='font-family:宋体;color:#555555;background:white'>本例第七行中以四种格式输出整型变量</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>a</span><span style='font-family:宋体;color:#555555;background:white'>的值，其中</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>“%5d ”</span><span style='font-family:宋体;color:#555555;background:white'>要求输出宽度为</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>5</span><span style='font-family:宋体;color:#555555;background:white'>，而</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>a</span><span style='font-family:宋体;color:#555555;background:white'>值为</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>15</span><span style='font-family:宋体;color:#555555;background:white'>只有两位故补三个空格。</span><span
style='font-family:"Tahoma","sans-serif";color:#555555;background:white'> </span><span
style='font-family:宋体;color:#555555;background:white'>第八行中以四种格式输出实型量</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>b</span><span style='font-family:宋体;color:#555555;background:white'>的值。其中</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>“%f”</span><span style='font-family:宋体;color:#555555;background:white'>和</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>“%lf ”</span><span style='font-family:宋体;color:#555555;background:white'>格式的输出相同，说明</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>“l”</span><span style='font-family:宋体;color:#555555;background:white'>符对</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>“f”</span><span style='font-family:宋体;color:#555555;background:white'>类型无影响。</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>“%5.4lf”</span><span style='font-family:宋体;color:#555555;background:
white'>指定输出宽度为</span><span lang=EN-US style='font-family:"Tahoma","sans-serif";
color:#555555;background:white'>5</span><span style='font-family:宋体;color:#555555;
background:white'>，精度为</span><span lang=EN-US style='font-family:"Tahoma","sans-serif";
color:#555555;background:white'>4</span><span style='font-family:宋体;color:#555555;
background:white'>，由于实际长度超过</span><span lang=EN-US style='font-family:"Tahoma","sans-serif";
color:#555555;background:white'>5</span><span style='font-family:宋体;color:#555555;
background:white'>故应该按实际位数输出，小数位数超过</span><span lang=EN-US style='font-family:
"Tahoma","sans-serif";color:#555555;background:white'>4</span><span
style='font-family:宋体;color:#555555;background:white'>位部分被截去。第九行输出双精度实数，</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>“%8.4lf ”</span><span style='font-family:宋体;color:#555555;background:
white'>由于指定精度为</span><span lang=EN-US style='font-family:"Tahoma","sans-serif";
color:#555555;background:white'>4</span><span style='font-family:宋体;color:#555555;
background:white'>位故截去了超过</span><span lang=EN-US style='font-family:"Tahoma","sans-serif";
color:#555555;background:white'>4</span><span style='font-family:宋体;color:#555555;
background:white'>位的部分。第十行输出字符量</span><span lang=EN-US style='font-family:"Tahoma","sans-serif";
color:#555555;background:white'>d</span><span style='font-family:宋体;color:#555555;
background:white'>，其中</span><span lang=EN-US style='font-family:"Tahoma","sans-serif";
color:#555555;background:white'>“%8c ”</span><span style='font-family:宋体;
color:#555555;background:white'>指定输出宽度为</span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555;background:white'>8</span><span
style='font-family:宋体;color:#555555;background:white'>故在输出字符</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>p</span><span style='font-family:宋体;color:#555555;background:white'>之前补加</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>7</span><span style='font-family:宋体;color:#555555;background:white'>个空格。</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<br style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><span style='font-family:宋体;color:red;border:none windowtext 1.0pt;
padding:0cm;background:white'><span style='text-decoration:initial;orphans: 2;
text-align:start;widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
word-spacing:0px'>使用</span><span lang=EN-US style='font-family:"Tahoma","sans-serif";
color:red;border:none windowtext 1.0pt;padding:0cm;background:white'>printf</span><span
style='font-family:宋体;color:red;border:none windowtext 1.0pt;padding:0cm;
background:white'>函数时还要注意一个问题，那就是输出表列中的求值顺序。不同的编译系统不一定相同，可以从左到右，也可从右到左。</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:red;border:none windowtext 1.0pt;
padding:0cm;background:white'>Turbo C</span><span style='font-family:宋体;
color:red;border:none windowtext 1.0pt;padding:0cm;background:white'>是按从右到左进行的。</span></span><span
style='font-family:宋体;color:#555555;background:white'><span style='orphans: 2;
text-align:start;widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>请看下面两个例子：</span></span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'><br style='text-decoration:
initial;orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<br style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>【例</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>4.5</span><span style='font-family:宋体;color:#555555;background:white'>】</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>main(){</span></span><br style='text-decoration:
initial;orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; int i=8;</span></span><br style='text-decoration:
initial;orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp;
printf(&quot;%d\n%d\n%d\n%d\n%d\n%d\n&quot;,++i,--i,i++,i--,-i++,-i--);</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>}</span></span><br style='text-decoration:initial;
orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<br style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>【例</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>4.6</span><span style='font-family:宋体;color:#555555;background:white'>】</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>main(){</span></span><br style='text-decoration:
initial;orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; int i=8;</span></span><br style='text-decoration:
initial;orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; printf(&quot;%d\n&quot;,++i);</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; printf(&quot;%d\n&quot;,--i);</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; printf(&quot;%d\n&quot;,i++);</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; printf(&quot;%d\n&quot;,i--);</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>printf(&quot;%d\n&quot;,-i++);</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; printf(&quot;%d\n&quot;,-i--);</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>}</span></span><br style='text-decoration:initial;
orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<br style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>这两个程序的区别是用一个</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>printf</span><span style='font-family:宋体;color:#555555;background:white'>语句和多个</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>printf </span><span style='font-family:宋体;color:#555555;background:white'>语句输出。但从结果可以看出是不同的。为什么结果会不同呢？就是因为</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>printf</span><span style='font-family:宋体;color:#555555;background:white'>函数对输出表中各量求值的顺序是自右至左进行的。在第一例中，先对最后一项</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>“-i--”</span><span style='font-family:宋体;color:#555555;background:white'>求值，结果为</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>-8,</span><span style='font-family:宋体;color:#555555;background:white'>然后</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>i</span><span style='font-family:宋体;color:#555555;background:white'>自减</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>1</span><span style='font-family:宋体;color:#555555;background:white'>后为</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>7</span><span style='font-family:宋体;color:#555555;background:white'>。</span><span
style='font-family:"Tahoma","sans-serif";color:#555555;background:white'> </span><span
style='font-family:宋体;color:#555555;background:white'>再对</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>“-i++”</span><span style='font-family:宋体;color:#555555;background:white'>项求值得</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>-7</span><span style='font-family:宋体;color:#555555;background:white'>，然后</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>i</span><span style='font-family:宋体;color:#555555;background:white'>自增</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>1</span><span style='font-family:宋体;color:#555555;background:white'>后为</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>8</span><span style='font-family:宋体;color:#555555;background:white'>。再对</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>“i--”</span><span style='font-family:宋体;color:#555555;background:white'>项求值得</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>8</span><span style='font-family:宋体;color:#555555;background:white'>，然后</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>i</span><span style='font-family:宋体;color:#555555;background:white'>再自减</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>1</span><span style='font-family:宋体;color:#555555;background:white'>后为</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>7</span><span style='font-family:宋体;color:#555555;background:white'>。再求</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>“i++”</span><span style='font-family:宋体;color:#555555;background:white'>项得</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>7</span><span style='font-family:宋体;color:#555555;background:white'>，然后</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>i</span><span style='font-family:宋体;color:#555555;background:white'>再自增</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>1</span><span style='font-family:宋体;color:#555555;background:white'>后为</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>8</span><span style='font-family:宋体;color:#555555;background:white'>。</span><span
style='font-family:"Tahoma","sans-serif";color:#555555;background:white'> </span><span
style='font-family:宋体;color:#555555;background:white'>再求</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>“--i”</span><span style='font-family:宋体;color:#555555;background:white'>项，</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>i</span><span style='font-family:宋体;color:#555555;background:white'>先自减</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>1</span><span style='font-family:宋体;color:#555555;background:white'>后输出，输出值为</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>7</span><span style='font-family:宋体;color:#555555;background:white'>。</span><span
style='font-family:"Tahoma","sans-serif";color:#555555;background:white'> </span><span
style='font-family:宋体;color:#555555;background:white'>最后才求输出表列中的第一项</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>“++i”</span><span style='font-family:宋体;color:#555555;background:white'>，此时</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>i</span><span style='font-family:宋体;color:#555555;background:white'>自增</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>1</span><span style='font-family:宋体;color:#555555;background:white'>后输出</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>8</span><span style='font-family:宋体;color:#555555;background:white'>。</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<br style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>但是必须注意，求值顺序虽是自右至左，但是输出顺序还是从左至右，因此得到的结果是上述输出结果。</span></span></p>

<p class=MsoNormal><span lang=EN-US style='font-family:"Tahoma","sans-serif";
color:#555555;background:white'>scanf</span><span style='font-family:宋体;
color:#555555;background:white'>函数称为格式输入函数，即按用户指定的格式从键盘上把数据输入到指定的变量之中。</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<br>
</span></p>

<h3 style='margin:0cm;margin-bottom:.0001pt;line-height:30.0pt;background:white;
vertical-align:middle'><span style='text-decoration:initial'><span
style='font-size:12.0pt;font-family:宋体;color:red;border:none windowtext 1.0pt;
padding:0cm'>一、</span><span lang=EN-US style='font-size:12.0pt;font-family:
"Tahoma","sans-serif";color:red;border:none windowtext 1.0pt;padding:0cm'>scanf</span><span
style='font-size:12.0pt;font-family:宋体;color:red;border:none windowtext 1.0pt;
padding:0cm'>函数的一般形式</span></span></h3>

<p class=MsoNormal><span lang=EN-US style='font-family:"Tahoma","sans-serif";
color:#555555;background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>scanf</span><span style='font-family:宋体;
color:#555555;background:white'>函数是一个标准库函数，它的函数原型在头文件</span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555;background:white'>“stdio.h”</span><span
style='font-family:宋体;color:#555555;background:white'>中，与</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>printf</span><span style='font-family:宋体;color:#555555;background:white'>函数相同，Ｃ语言也允许在使用</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>scanf</span><span style='font-family:宋体;color:#555555;background:white'>函数之前不必包含</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>stdio.h</span><span style='font-family:宋体;color:#555555;background:white'>文件。</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>scanf</span><span style='font-family:宋体;color:#555555;background:white'>函数的一般形式为：</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp;&nbsp;&nbsp; scanf(“</span></span><span
style='font-family:宋体;color:#555555;background:white'>格式控制字符串</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>”</span><span style='font-family:宋体;color:#555555;background:white'>，地址表列</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>);</span></span><span lang=EN-US style='font-family:"Tahoma","sans-serif";
color:#555555'><br style='text-decoration:initial;orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
word-spacing:0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>其中，格式控制字符串的作用与</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>printf</span><span style='font-family:宋体;color:#555555;background:white'>函数相同，但不能显示非格式字符串，也就是不能显示提示字符串。地址表列中给出各变量的地址。地址是由地址运算符</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>“&amp;”</span><span style='font-family:宋体;color:#555555;background:white'>后跟变量名组成的。</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<br style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>例如：</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>&amp;a, &amp;b&nbsp;</span><span style='font-family:宋体;color:#555555;
background:white'>分别表示变量</span><span lang=EN-US style='font-family:"Tahoma","sans-serif";
color:#555555;background:white'>a</span><span style='font-family:宋体;color:#555555;
background:white'>和变量</span><span lang=EN-US style='font-family:"Tahoma","sans-serif";
color:#555555;background:white'>b </span><span style='font-family:宋体;
color:#555555;background:white'>的地址。</span></span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'><br style='text-decoration:
initial;orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<br style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>这个地址就是编译系统在内存中给</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>a,b</span><span style='font-family:宋体;color:#555555;background:white'>变量分配的地址。在Ｃ语言中，使用了地址这个概念，这是与其它语言不同的。</span><span
style='font-family:"Tahoma","sans-serif";color:#555555;background:white'> </span><span
style='font-family:宋体;color:#555555;background:white'>应该把变量的值和变量的地址这两个不同的概念区别开来。变量的地址是</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>C</span><span style='font-family:宋体;color:#555555;background:white'>编译系统分配的，用户不必关心具体的地址是多少。</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<br style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><span style='font-family:宋体;color:purple;border:none windowtext 1.0pt;
padding:0cm;background:white'><span style='text-decoration:initial;orphans: 2;
text-align:start;widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
word-spacing:0px'>变量的地址和变量值的关系如下：</span></span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'><br style='text-decoration:
initial;orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<br style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>在赋值表达式中给变量赋值，如：</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp;&nbsp;&nbsp; a=567</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp;</span></span><span style='font-family:宋体;
color:#555555;background:white'>则，</span><span lang=EN-US style='font-family:
"Tahoma","sans-serif";color:#555555;background:white'>a</span><span
style='font-family:宋体;color:#555555;background:white'>为变量名，</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>567</span><span style='font-family:宋体;color:#555555;background:white'>是变量的值，</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>&amp;a</span><span style='font-family:宋体;color:#555555;background:white'>是变量</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>a</span><span style='font-family:宋体;color:#555555;background:white'>的地址。</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<br style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>但在赋值号左边是变量名，不能写地址，而</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>scanf</span><span style='font-family:宋体;color:#555555;background:white'>函数在本质上也是给变量赋值，但要求写变量的地址，如</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>&amp;a</span><span style='font-family:宋体;color:#555555;background:white'>。这两者在形式上是不同的。</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>&amp;</span><span style='font-family:宋体;color:#555555;background:white'>是一个取地址运算符，</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>&amp;a</span><span style='font-family:宋体;color:#555555;background:white'>是一个表达式，其功能是求变量的地址。</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<br style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>【例</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>4.7</span><span style='font-family:宋体;color:#555555;background:white'>】</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>main(){</span></span><br style='text-decoration:
initial;orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; int a,b,c;</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; printf(&quot;input a,b,c\n&quot;);</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp;
scanf(&quot;%d%d%d&quot;,&amp;a,&amp;b,&amp;c);</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; printf(&quot;a=%d,b=%d,c=%d&quot;,a,b,c);</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>}</span></span><br style='text-decoration:initial;
orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<br style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>在本例中，由于</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>scanf</span><span style='font-family:宋体;color:#555555;background:white'>函数本身不能显示提示串，故先用</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>printf</span><span style='font-family:宋体;color:#555555;background:white'>语句在屏幕上输出提示，请用户输入</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>a</span><span style='font-family:宋体;color:#555555;background:white'>、</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>b</span><span style='font-family:宋体;color:#555555;background:white'>、</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>c</span><span style='font-family:宋体;color:#555555;background:white'>的值。执行</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>scanf</span><span style='font-family:宋体;color:#555555;background:white'>语句，则退出</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>TC</span><span style='font-family:宋体;color:#555555;background:white'>屏幕进入用户屏幕等待用户输入。用户输入</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>7&nbsp; 8&nbsp; 9</span><span style='font-family:宋体;color:#555555;
background:white'>后按下回车键，此时，系统又将返回</span><span lang=EN-US style='font-family:
"Tahoma","sans-serif";color:#555555;background:white'>TC</span><span
style='font-family:宋体;color:#555555;background:white'>屏幕。在</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>scanf</span><span style='font-family:宋体;color:#555555;background:white'>语句的格式串中由于没有非格式字符在</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>“%d%d%d”</span><span style='font-family:宋体;color:#555555;background:
white'>之间作输入时的间隔，因此在输入时要用一个以上的空格或回车键作为每两个输入数之间的间隔。如：</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>7 8 9</span></span><br style='text-decoration:
initial;orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>或</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>7</span></span><br style='text-decoration:initial;
orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>8</span></span><br style='text-decoration:initial;
orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>9</span></span><br style='text-decoration:initial;
orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<br>
</span></p>

<h3 style='margin:0cm;margin-bottom:.0001pt;line-height:30.0pt;background:white;
vertical-align:middle'><span style='text-decoration:initial'><span
style='font-size:12.0pt;font-family:宋体;color:red;border:none windowtext 1.0pt;
padding:0cm'>二、格式字符串</span></span></h3>

<p class=MsoNormal><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>格式字符串的一般形式为：</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>%[*][</span><span style='font-family:宋体;color:#555555;background:white'>输入数据宽度</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>][</span><span style='font-family:宋体;color:#555555;background:white'>长度</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>]</span><span style='font-family:宋体;color:#555555;background:white'>类型</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>其中有方括号</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>[]</span><span style='font-family:宋体;color:#555555;background:white'>的项为任选项。各项的意义如下：</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<br>
</span></p>

<p class=MsoNormal align=left style='margin-left:22.5pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>1.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><strong style='text-decoration:initial'><span style='font-family:
宋体;color:green;border:none windowtext 1.0pt;padding:0cm'><span
style='text-decoration:initial'>类型：表示输入数据的类型，其格式符和意义如下表所示。</span></span></strong></p>

<div align=center>

<table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0
 style='background:white;border-collapse:collapse;text-decoration:initial;
 orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
 -webkit-text-stroke-width: 0px;word-spacing:0px'>
 <tr style='text-decoration:initial'>
  <td width=103 style='width:77.25pt;border:solid #999999 1.0pt;padding:3.75pt 3.75pt 3.75pt 3.75pt;
  text-decoration:initial'>
  <p class=MsoNormal style='line-height:16.5pt'><span style='font-family:宋体;
  color:#555555'>格式</span></p>
  </td>
  <td width=278 style='width:208.5pt;border:solid #999999 1.0pt;border-left:
  none;padding:3.75pt 3.75pt 3.75pt 3.75pt;text-decoration:initial'>
  <p class=MsoNormal style='line-height:16.5pt'><span style='font-family:宋体;
  color:#555555'>字符意义</span></p>
  </td>
 </tr>
 <tr style='text-decoration:initial'>
  <td width=103 style='width:77.25pt;border:solid #999999 1.0pt;border-top:
  none;padding:3.75pt 3.75pt 3.75pt 3.75pt;text-decoration:initial'>
  <p class=MsoNormal style='line-height:16.5pt'><span lang=EN-US
  style='font-family:"Tahoma","sans-serif";color:#555555'>d</span></p>
  </td>
  <td width=278 style='width:208.5pt;border-top:none;border-left:none;
  border-bottom:solid #999999 1.0pt;border-right:solid #999999 1.0pt;
  padding:3.75pt 3.75pt 3.75pt 3.75pt;text-decoration:initial'>
  <p class=MsoNormal style='line-height:16.5pt'><span style='font-family:宋体;
  color:#555555'>输入十进制整数</span></p>
  </td>
 </tr>
 <tr style='text-decoration:initial'>
  <td width=103 style='width:77.25pt;border:solid #999999 1.0pt;border-top:
  none;padding:3.75pt 3.75pt 3.75pt 3.75pt;text-decoration:initial'>
  <p class=MsoNormal style='line-height:16.5pt'><span lang=EN-US
  style='font-family:"Tahoma","sans-serif";color:#555555'>o</span></p>
  </td>
  <td width=278 style='width:208.5pt;border-top:none;border-left:none;
  border-bottom:solid #999999 1.0pt;border-right:solid #999999 1.0pt;
  padding:3.75pt 3.75pt 3.75pt 3.75pt;text-decoration:initial'>
  <p class=MsoNormal style='line-height:16.5pt'><span style='font-family:宋体;
  color:#555555'>输入八进制整数</span></p>
  </td>
 </tr>
 <tr style='text-decoration:initial'>
  <td width=103 style='width:77.25pt;border:solid #999999 1.0pt;border-top:
  none;padding:3.75pt 3.75pt 3.75pt 3.75pt;text-decoration:initial'>
  <p class=MsoNormal style='line-height:16.5pt'><span lang=EN-US
  style='font-family:"Tahoma","sans-serif";color:#555555'>x</span></p>
  </td>
  <td width=278 style='width:208.5pt;border-top:none;border-left:none;
  border-bottom:solid #999999 1.0pt;border-right:solid #999999 1.0pt;
  padding:3.75pt 3.75pt 3.75pt 3.75pt;text-decoration:initial'>
  <p class=MsoNormal style='line-height:16.5pt'><span style='font-family:宋体;
  color:#555555'>输入十六进制整数</span></p>
  </td>
 </tr>
 <tr style='text-decoration:initial'>
  <td width=103 style='width:77.25pt;border:solid #999999 1.0pt;border-top:
  none;padding:3.75pt 3.75pt 3.75pt 3.75pt;text-decoration:initial'>
  <p class=MsoNormal style='line-height:16.5pt'><span lang=EN-US
  style='font-family:"Tahoma","sans-serif";color:#555555'>u</span></p>
  </td>
  <td width=278 style='width:208.5pt;border-top:none;border-left:none;
  border-bottom:solid #999999 1.0pt;border-right:solid #999999 1.0pt;
  padding:3.75pt 3.75pt 3.75pt 3.75pt;text-decoration:initial'>
  <p class=MsoNormal style='line-height:16.5pt'><span style='font-family:宋体;
  color:#555555'>输入无符号十进制整数</span></p>
  </td>
 </tr>
 <tr style='text-decoration:initial'>
  <td width=103 style='width:77.25pt;border:solid #999999 1.0pt;border-top:
  none;padding:3.75pt 3.75pt 3.75pt 3.75pt;text-decoration:initial'>
  <p class=MsoNormal style='line-height:16.5pt'><span lang=EN-US
  style='font-family:"Tahoma","sans-serif";color:#555555'>f</span><span
  style='font-family:宋体;color:#555555'>或</span><span lang=EN-US
  style='font-family:"Tahoma","sans-serif";color:#555555'>e</span></p>
  </td>
  <td width=278 style='width:208.5pt;border-top:none;border-left:none;
  border-bottom:solid #999999 1.0pt;border-right:solid #999999 1.0pt;
  padding:3.75pt 3.75pt 3.75pt 3.75pt;text-decoration:initial'>
  <p class=MsoNormal style='line-height:16.5pt'><span style='font-family:宋体;
  color:#555555'>输入实型数</span><span lang=EN-US style='font-family:"Tahoma","sans-serif";
  color:#555555'>(</span><span style='font-family:宋体;color:#555555'>用小数形式或指数形式</span><span
  lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'>)</span></p>
  </td>
 </tr>
 <tr style='text-decoration:initial'>
  <td width=103 style='width:77.25pt;border:solid #999999 1.0pt;border-top:
  none;padding:3.75pt 3.75pt 3.75pt 3.75pt;text-decoration:initial'>
  <p class=MsoNormal style='line-height:16.5pt'><span lang=EN-US
  style='font-family:"Tahoma","sans-serif";color:#555555'>c</span></p>
  </td>
  <td width=278 style='width:208.5pt;border-top:none;border-left:none;
  border-bottom:solid #999999 1.0pt;border-right:solid #999999 1.0pt;
  padding:3.75pt 3.75pt 3.75pt 3.75pt;text-decoration:initial'>
  <p class=MsoNormal style='line-height:16.5pt'><span style='font-family:宋体;
  color:#555555'>输入单个字符</span></p>
  </td>
 </tr>
 <tr style='text-decoration:initial'>
  <td width=103 style='width:77.25pt;border:solid #999999 1.0pt;border-top:
  none;padding:3.75pt 3.75pt 3.75pt 3.75pt;text-decoration:initial'>
  <p class=MsoNormal style='line-height:16.5pt'><span lang=EN-US
  style='font-family:"Tahoma","sans-serif";color:#555555'>s</span></p>
  </td>
  <td width=278 style='width:208.5pt;border-top:none;border-left:none;
  border-bottom:solid #999999 1.0pt;border-right:solid #999999 1.0pt;
  padding:3.75pt 3.75pt 3.75pt 3.75pt;text-decoration:initial'>
  <p class=MsoNormal style='line-height:16.5pt'><span style='font-family:宋体;
  color:#555555'>输入字符串</span></p>
  </td>
 </tr>
</table>

</div>

<p class=MsoNormal style='line-height:16.5pt;background:white'><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'>&nbsp;</span></p>

<p class=MsoNormal align=left style='margin-left:22.5pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>2.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><strong style='text-decoration:initial'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:green;border:none windowtext 1.0pt;
padding:0cm'><span style='text-decoration:initial'>“*”</span></strong><strong><span
style='font-family:宋体;color:green;border:none windowtext 1.0pt;padding:0cm'>符</span></strong><strong><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:green;border:none windowtext 1.0pt;
padding:0cm'>:</span></strong><strong><span style='font-family:宋体;color:green;
border:none windowtext 1.0pt;padding:0cm'>用以表示该输入项</span></strong><strong><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:green;border:none windowtext 1.0pt;
padding:0cm'>,</span></strong><strong><span style='font-family:宋体;color:green;
border:none windowtext 1.0pt;padding:0cm'>读入后不赋予相应的变量，即跳过该输入值。</span></span></strong><span
style='font-family:宋体;color:#555555'>如：</span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>scanf(&quot;%d %*d
%d&quot;,&amp;a,&amp;b);</span><span style='font-family:宋体;color:#555555'>。当输入为：</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'>1&nbsp;&nbsp;
2&nbsp;&nbsp; 3</span><span style='font-family:宋体;color:#555555'>时，把</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'>1</span><span
style='font-family:宋体;color:#555555'>赋予</span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>a</span><span
style='font-family:宋体;color:#555555'>，</span><span lang=EN-US style='font-family:
"Tahoma","sans-serif";color:#555555'>2</span><span style='font-family:宋体;
color:#555555'>被跳过，</span><span lang=EN-US style='font-family:"Tahoma","sans-serif";
color:#555555'>3</span><span style='font-family:宋体;color:#555555'>赋予</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'>b</span><span
style='font-family:宋体;color:#555555'>。</span></p>

<p class=MsoNormal align=left style='margin-left:22.5pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>3.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><strong style='text-decoration:initial'><span style='font-family:
宋体;color:green;border:none windowtext 1.0pt;padding:0cm'><span
style='text-decoration:initial'>宽度</span></strong><strong><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:green;border:none windowtext 1.0pt;
padding:0cm'>:</span></strong><strong><span style='font-family:宋体;color:green;
border:none windowtext 1.0pt;padding:0cm'>用十进制整数指定输入的宽度</span></strong><strong><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:green;border:none windowtext 1.0pt;
padding:0cm'>(</span></strong><strong><span style='font-family:宋体;color:green;
border:none windowtext 1.0pt;padding:0cm'>即字符数</span></strong><strong><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:green;border:none windowtext 1.0pt;
padding:0cm'>)</span></strong><strong><span style='font-family:宋体;color:green;
border:none windowtext 1.0pt;padding:0cm'>。</span></span></strong></p>

<p class=MsoNormal><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>例如：</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; &nbsp; &nbsp;
&nbsp;scanf(&quot;%5d&quot;,&amp;a);</span></span><br style='text-decoration:
initial;orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>输入</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>12345678</span><span style='font-family:宋体;color:#555555;background:
white'>只把</span><span lang=EN-US style='font-family:"Tahoma","sans-serif";
color:#555555;background:white'>12345</span><span style='font-family:宋体;
color:#555555;background:white'>赋予变量</span><span lang=EN-US style='font-family:
"Tahoma","sans-serif";color:#555555;background:white'>a</span><span
style='font-family:宋体;color:#555555;background:white'>，其余部分被截去。</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<br style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>又如：</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
scanf(&quot;%4d%4d&quot;,&amp;a,&amp;b);</span></span><br style='text-decoration:
initial;orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>输入</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>12345678</span><span style='font-family:宋体;color:#555555;background:
white'>将把</span><span lang=EN-US style='font-family:"Tahoma","sans-serif";
color:#555555;background:white'>1234</span><span style='font-family:宋体;
color:#555555;background:white'>赋予</span><span lang=EN-US style='font-family:
"Tahoma","sans-serif";color:#555555;background:white'>a</span><span
style='font-family:宋体;color:#555555;background:white'>，而把</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>5678</span><span style='font-family:宋体;color:#555555;background:white'>赋予</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>b</span><span style='font-family:宋体;color:#555555;background:white'>。</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<br>
</span></p>

<p class=MsoNormal align=left style='margin-left:22.5pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>4.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><strong style='text-decoration:initial'><span style='font-family:
宋体;color:green;border:none windowtext 1.0pt;padding:0cm'><span
style='text-decoration:initial'>长度</span></strong><strong><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:green;border:none windowtext 1.0pt;
padding:0cm'>:</span></strong><strong><span style='font-family:宋体;color:green;
border:none windowtext 1.0pt;padding:0cm'>长度格式符为</span></strong><strong><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:green;border:none windowtext 1.0pt;
padding:0cm'>l</span></strong><strong><span style='font-family:宋体;color:green;
border:none windowtext 1.0pt;padding:0cm'>和</span></strong><strong><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:green;border:none windowtext 1.0pt;
padding:0cm'>h</span></strong><strong><span style='font-family:宋体;color:green;
border:none windowtext 1.0pt;padding:0cm'>，</span></strong><strong><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:green;border:none windowtext 1.0pt;
padding:0cm'>l</span></strong><strong><span style='font-family:宋体;color:green;
border:none windowtext 1.0pt;padding:0cm'>表示输入长整型数据</span></strong><strong><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:green;border:none windowtext 1.0pt;
padding:0cm'>(</span></strong><strong><span style='font-family:宋体;color:green;
border:none windowtext 1.0pt;padding:0cm'>如</span></strong><strong><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:green;border:none windowtext 1.0pt;
padding:0cm'>%ld) </span></strong><strong><span style='font-family:宋体;
color:green;border:none windowtext 1.0pt;padding:0cm'>和双精度浮点数</span></strong><strong><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:green;border:none windowtext 1.0pt;
padding:0cm'>(</span></strong><strong><span style='font-family:宋体;color:green;
border:none windowtext 1.0pt;padding:0cm'>如</span></strong><strong><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:green;border:none windowtext 1.0pt;
padding:0cm'>%lf)</span></strong><strong><span style='font-family:宋体;
color:green;border:none windowtext 1.0pt;padding:0cm'>。</span></span></strong><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'>h</span><span
style='font-family:宋体;color:#555555'>表示输入短整型数据。</span></p>

<p class=MsoNormal><span style='font-family:宋体;color:red;border:none windowtext 1.0pt;
padding:0cm;background:white'><span style='text-decoration:initial;orphans: 2;
text-align:start;widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
word-spacing:0px'>使用</span><span lang=EN-US style='font-family:"Tahoma","sans-serif";
color:red;border:none windowtext 1.0pt;padding:0cm;background:white'>scanf</span><span
style='font-family:宋体;color:red;border:none windowtext 1.0pt;padding:0cm;
background:white'>函数还必须注意以下几点：</span></span><span lang=EN-US style='font-family:
"Tahoma","sans-serif";color:#555555'><br style='text-decoration:initial;
orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<br>
</span></p>

<p class=MsoNormal align=left style='margin-left:22.5pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>1.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span lang=EN-US style='font-family:"Tahoma","sans-serif";
color:#555555'>scanf</span><span style='font-family:宋体;color:#555555'>函数中没有精度控制，如：</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'>scanf(&quot;%5.2f&quot;,&amp;a);</span><span
style='font-family:宋体;color:#555555'>是非法的。不能企图用此语句输入小数为</span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>2</span><span
style='font-family:宋体;color:#555555'>位的实数。</span></p>

<p class=MsoNormal align=left style='margin-left:22.5pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>2.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span lang=EN-US style='font-family:"Tahoma","sans-serif";
color:#555555'>scanf</span><span style='font-family:宋体;color:#555555'>中要求给出变量地址，如给出变量名则会出错。如</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'>
scanf(&quot;%d&quot;,a);</span><span style='font-family:宋体;color:#555555'>是非法的，应改为</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'>scnaf(&quot;%d&quot;,&amp;a);</span><span
style='font-family:宋体;color:#555555'>才是合法的。</span></p>

<p class=MsoNormal align=left style='margin-left:22.5pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>3.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:#555555'>在输入多个数值数据时，若格式控制串中没有非格式字符作输入数据之间的间隔则可用空格，</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'>TAB</span><span
style='font-family:宋体;color:#555555'>或回车作间隔。</span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>C</span><span
style='font-family:宋体;color:#555555'>编译在碰到空格，</span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>TAB</span><span
style='font-family:宋体;color:#555555'>，回车或非法数据</span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>(</span><span
style='font-family:宋体;color:#555555'>如对</span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>“%d”</span><span
style='font-family:宋体;color:#555555'>输入</span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>“12A”</span><span
style='font-family:宋体;color:#555555'>时，</span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>A</span><span
style='font-family:宋体;color:#555555'>即为非法数据</span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>)</span><span
style='font-family:宋体;color:#555555'>时即认为该数据结束。</span></p>

<p class=MsoNormal align=left style='margin-left:22.5pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>4.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style='font-family:宋体;color:#555555'>在输入字符数据时，若格式控制串中无非格式字符，则认为所有输入的字符均为有效字符。</span></p>

<p class=MsoNormal><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>例如：</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
scanf(&quot;%c%c%c&quot;,&amp;a,&amp;b,&amp;c);</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>输入</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>&nbsp;d&nbsp;&nbsp; e&nbsp;&nbsp; f&nbsp;</span><span style='font-family:
宋体;color:#555555;background:white'>则把</span><span lang=EN-US style='font-family:
"Tahoma","sans-serif";color:#555555;background:white'>'d'</span><span
style='font-family:宋体;color:#555555;background:white'>赋予</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>a, ' ' </span><span style='font-family:宋体;color:#555555;background:white'>赋予</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>b,'e'</span><span style='font-family:宋体;color:#555555;background:white'>赋予</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>c</span><span style='font-family:宋体;color:#555555;background:white'>。只有当输入为</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>&nbsp;def&nbsp;</span><span style='font-family:宋体;color:#555555;
background:white'>时，才能把</span><span lang=EN-US style='font-family:"Tahoma","sans-serif";
color:#555555;background:white'>'d'</span><span style='font-family:宋体;
color:#555555;background:white'>赋于</span><span lang=EN-US style='font-family:
"Tahoma","sans-serif";color:#555555;background:white'>a,'e'</span><span
style='font-family:宋体;color:#555555;background:white'>赋予</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>b,'f'</span><span style='font-family:宋体;color:#555555;background:white'>赋予</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>c</span><span style='font-family:宋体;color:#555555;background:white'>。</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<br style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>如果在格式控制中加入空格作为间隔，如</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>:</span></span><span lang=EN-US style='font-family:"Tahoma","sans-serif";
color:#555555'><br style='text-decoration:initial;orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
word-spacing:0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>scanf (&quot;%c %c %c&quot;,&amp;a,&amp;b,&amp;c);</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>则输入时各数据之间可加空格。</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<br style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>【例</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>4.8</span><span style='font-family:宋体;color:#555555;background:white'>】</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>main(){</span></span><br style='text-decoration:
initial;orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; char a,b;</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; printf(&quot;input character a,b\n&quot;);</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; scanf(&quot;%c%c&quot;,&amp;a,&amp;b);</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; printf(&quot;%c%c\n&quot;,a,b);</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>}</span></span><br style='text-decoration:initial;
orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<br style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>由于</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>scanf</span><span style='font-family:宋体;color:#555555;background:white'>函数</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>&quot;%c%c&quot;</span><span style='font-family:宋体;color:#555555;
background:white'>中没有空格，输入</span><span lang=EN-US style='font-family:"Tahoma","sans-serif";
color:#555555;background:white'>M&nbsp; N</span><span style='font-family:宋体;
color:#555555;background:white'>，结果输出只有</span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555;background:white'>M</span><span
style='font-family:宋体;color:#555555;background:white'>。而输入改为</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>MN</span><span style='font-family:宋体;color:#555555;background:white'>时则可输出</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>MN</span><span style='font-family:宋体;color:#555555;background:white'>两字符。</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<br style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>【例</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>4.9</span><span style='font-family:宋体;color:#555555;background:white'>】</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>main(){</span></span><br style='text-decoration:
initial;orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; char a,b;</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; printf(&quot;input character a,b\n&quot;);</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; scanf(&quot;%c %c&quot;,&amp;a,&amp;b);</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; printf(&quot;\n%c%c\n&quot;,a,b);</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp;}</span></span><br style='text-decoration:
initial;orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<br style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>本例表示</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>scanf</span><span style='font-family:宋体;color:#555555;background:white'>格式控制串</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>&quot;%c %c&quot;</span><span style='font-family:宋体;color:#555555;
background:white'>之间有空格时，输入的数据之间可以有空格间隔。</span></span><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'><br style='text-decoration:
initial;orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<br>
</span></p>

<p class=MsoNormal align=left style='margin-left:22.5pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>5.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><strong style='text-decoration:initial'><span style='font-family:
宋体;color:green;border:none windowtext 1.0pt;padding:0cm'><span
style='text-decoration:initial'>如果格式控制串中有非格式字符则输入时也要输入该非格式字符。</span></span></strong></p>

<p class=MsoNormal><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>例如：</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; &nbsp; &nbsp;
&nbsp;scanf(&quot;%d,%d,%d&quot;,&amp;a,&amp;b,&amp;c);</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>其中用非格式符</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>“ , ”</span><span style='font-family:宋体;color:#555555;background:white'>作间隔符，故输入时应为：</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; &nbsp; &nbsp; &nbsp;5,6,7</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>又如：</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp;&nbsp;&nbsp;
scanf(&quot;a=%d,b=%d,c=%d&quot;,&amp;a,&amp;b,&amp;c);</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>则输入应为：</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; &nbsp; &nbsp;a=5,b=6,c=7</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<br>
</span></p>

<p class=MsoNormal align=left style='margin-left:22.5pt;text-align:left;
text-indent:-18.0pt;line-height:16.5pt;background:white'><span lang=EN-US
style='font-family:"Tahoma","sans-serif";color:#555555'>6.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><strong style='text-decoration:initial'><span style='font-family:
宋体;color:green;border:none windowtext 1.0pt;padding:0cm'><span
style='text-decoration:initial'>如输入的数据与输出的类型不一致时，虽然编译能够通过，但结果将不正确。</span></span></strong></p>

<p class=MsoNormal><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>【例</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>4.10</span><span style='font-family:宋体;color:#555555;background:white'>】</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>main(){</span></span><br style='text-decoration:
initial;orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; int a;</span></span><br style='text-decoration:
initial;orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; printf(&quot;input a number\n&quot;);</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; scanf(&quot;%d&quot;,&amp;a);</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; printf(&quot;%ld&quot;,a);</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>}</span></span><br style='text-decoration:initial;
orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<br style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp;&nbsp;&nbsp; </span></span><span
style='font-family:宋体;color:#555555;background:white'>由于输入数据类型为整型，而输出语句的格式串中说明为长整型，因此输出结果和输入数据不符。如改动程序如下：</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<br style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>【例</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>4.11</span><span style='font-family:宋体;color:#555555;background:white'>】</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>main(){</span></span><br style='text-decoration:
initial;orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp;&nbsp;&nbsp; long a;</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp;&nbsp;&nbsp; printf(&quot;input a long
integer\n&quot;);</span></span><br style='text-decoration:initial;orphans: 2;
text-align:start;widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
word-spacing:0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp;&nbsp;&nbsp; scanf(&quot;%ld&quot;,&amp;a);</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp;&nbsp;&nbsp; printf(&quot;%ld&quot;,a);</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>}</span></span><br style='text-decoration:initial;
orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<br style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>运行结果为：</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp;&nbsp;&nbsp; input a long integer</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp;&nbsp;&nbsp; 1234567890</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; &nbsp; 1234567890</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>当输入数据改为长整型后，输入输出数据相等。</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<br style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>【例</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>4.12</span><span style='font-family:宋体;color:#555555;background:white'>】</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>main(){</span></span><br style='text-decoration:
initial;orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; char a,b,c;</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; printf(&quot;input character a,b,c\n&quot;);</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp; scanf(&quot;%c %c
%c&quot;,&amp;a,&amp;b,&amp;c);</span></span><br style='text-decoration:initial;
orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp;
printf(&quot;%d,%d,%d\n%c,%c,%c\n&quot;,a,b,c,a-32,b-32,c-32);</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp;}</span></span><br style='text-decoration:
initial;orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<br style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp;&nbsp;&nbsp; </span></span><span
style='font-family:宋体;color:#555555;background:white'>输入三个小写字母，输出其</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>ASCII</span><span style='font-family:宋体;color:#555555;background:white'>码和对应的大写字母。</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
</span><span style='font-family:宋体;color:#555555;background:white'><span
style='orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;float:none;word-spacing:0px'>【例</span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555;background:
white'>4.13</span><span style='font-family:宋体;color:#555555;background:white'>】</span></span><span
lang=EN-US style='font-family:"Tahoma","sans-serif";color:#555555'><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>main(){</span></span><br style='text-decoration:
initial;orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp;int a;</span></span><br style='text-decoration:
initial;orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp;long b;</span></span><br style='text-decoration:
initial;orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp;float f;</span></span><br style='text-decoration:
initial;orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp;double d;</span></span><br style='text-decoration:
initial;orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>&nbsp;char c;</span></span><br style='text-decoration:
initial;orphans: 2;text-align:start;widows: 2;-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;word-spacing:0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>printf(&quot;\nint:%d\nlong:%d\nfloat:%d\ndouble:%d\nchar:%d\n&quot;,sizeof(a),sizeof(b),sizeof(f),sizeof(d),sizeof(c));</span></span><br
style='text-decoration:initial;orphans: 2;text-align:start;widows: 2;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px'>
<span style='background:white'><span style='orphans: 2;text-align:start;
widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;
float:none;word-spacing:0px'>}</span></span></span></p>

<p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>

</div>

</body>

</html>
